<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : xml2html.xsl
    Created on : 4 avril 2011, 09:41
    Author     : altraver
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:output method="html" encoding="UTF-8"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
	<xsl:template match="membres">
		
		<xsl:if test="count(membre)=0">
			0
		</xsl:if>

		<xsl:if test="count(membre)>0">
			<xsl:value-of select="count(membre)" />

			<script type="text/javascript">
				var myData=[<xsl:apply-templates select="membre" />];
			</script>
			<script type="text/javascript" src="resources/js/array-grid.js"></script>
			<div id="grid-example"></div>
		</xsl:if>
	</xsl:template>

	<xsl:template match="membre">
		[
		'<xsl:value-of select="name" />',
		'<xsl:value-of select="function" />',
		'<xsl:value-of select="phone" />',
		'<xsl:value-of select="office" />',
		'<xsl:apply-templates select="structure" />'
		]
		<xsl:if test = "not (position()=last())">
		,
		</xsl:if>
	</xsl:template>

	<xsl:template match="structure">
		<!--<xsl:value-of select="level" />-->
		<xsl:value-of select="complete-name" />
	</xsl:template>

</xsl:stylesheet>
